import wx
import ui_elements.panel_tabset as pt


class SimpleWindow(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, "GSB Panel Test")
        
        weapon_ctrls_col1 = [
                        {'type' : 'text', 'desc' : 'Col1 Req', 'key' : 'test_ctrl1', 'tip' : 'The minimum range of the weapon.'},
                        {'type' : 'text', 'desc' : 'Col1 Opt', 'key' : 'test_ctrl2', 'tip' : 'The minimum range of the weapon.'}
                    ]
        
        weapon_ctrls_col2 = [
                        {'type' : 'text', 'desc' : 'Col2 Inv', 'key' : 'test_ctrl3', 'tip' : 'The minimum range of the weapon.'},
                        {'type' : 'text', 'desc' : 'Col2 Opt', 'key' : 'test_ctrl4', 'tip' : 'The minimum range of the weapon.'}
                    ]
        
        final_ctrls = [
            {'type':'text', 'desc':'Final', 'key':'final'}
        ]

        weapon_text = [
                        {'type' : 'text', 'text' : 'DPS: %.1f dam/s', 'update_func' : self.dps_update}
                    ]
        
        panel_list = [
                        {'type' : 'attributes', 'controls' : [weapon_ctrls_col1, weapon_ctrls_col2]},
                        {'type' : 'spacer'},
                        {'type' : 'additional', 'items' : [weapon_text]},
                        {'type' : 'attributes', 'controls' : [final_ctrls]}
                     ]
        
        panel_list2 = [
                        {'type' : 'attributes', 'controls' : [weapon_ctrls_col1, weapon_ctrls_col2]},
                        {'type' : 'spacer'},
                        {'type' : 'additional', 'items' : [weapon_text]}
                     ]
        
        tabs = [{'name':'Tabs 1', 'panel' : panel_list}, {'name':'Tabs 2', 'panel' : panel_list2}]
        
        module_info = {'required':['test_ctrl1', 'final'], 'optional':['test_ctrl2', 'test_ctrl4']}
        module_values = {'test_ctrl1':'Test1', 'test_ctrl2':'Test2', 'test_ctrl3':'Test3', 'final':'woot'}
        
        tabset = pt.PanelTabset(self, tabs, 1000)
        tabset.set_module(module_info, module_values)
        
        self.content = wx.BoxSizer(wx.HORIZONTAL)
        self.content.Add(tabset, 1, wx.EXPAND)
        self.SetSizer(self.content)
        self.Show()
    
    def dps_update(self):
        return
    
    def evt_value_updated(self, key, value, from_child=True):
        pass


app = wx.App(0)
sw = SimpleWindow()
app.MainLoop()
